package com.hxd.otc.common.enums;

import android.text.TextUtils;

import com.hxd.otc.R;
import com.hxd.otc.utils.ResourceUtil;

/**
 * Created by lzy on 2018/12/19 0019.
 * description ${广告商类型枚举}
 */
public enum RoleTypeEnum {
    NormalUser("-1", ResourceUtil.getString(R.string.normal_user)), NormalSliver("0", ResourceUtil.getString(R.string.general_advertiser)), NonInductiveSliver("1", ResourceUtil.getString(R.string.senseless_payment_to_advertisers));

    private final String mValue;
    private final String mDesc;

    RoleTypeEnum(String value, String desc) {
        mValue = value;
        mDesc = desc;
    }

    public String getValue() {
        return mValue;
    }

    public String getDesc() {
        return mDesc;
    }

    public static RoleTypeEnum getInstance(String value) {
        if (TextUtils.isEmpty(value)) return NormalUser;
        for (RoleTypeEnum roleTypeEnum : RoleTypeEnum.values()) {
            if (roleTypeEnum.mValue.equals(value)) return roleTypeEnum;
        }
        return null;
    }

    @Override
    public String toString() {
        return "RoleTypeEnum{" +
                "mValue='" + mValue + '\'' +
                ", mDesc='" + mDesc + '\'' +
                '}';
    }
}
